<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@page import="com.xcalendar.constant.XConstants"%>
<%String errorMessage = (String)request.getAttribute(XConstants.WRONY_MESSAGE); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../css/ui-lightness/jquery-ui-1.8.16.custom.css' />
<script type='text/javascript' src='../jquery/jquery-1.6.2.min.js'></script>
<script type='text/javascript' src='../jquery/jquery-ui-1.8.16.custom.min.js'></script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Register Page</title>
<style type='text/css'>
body {
	margin-top: 40px;
	text-align: center;
	font-size: 14px;
	font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
	color: #007FFF;
	background-image:url(../bg/6_3.jpg); 
	background-position: center;
	background-attachment: fixed;
	repeat-x: #FFFFFF
}
p {
	color: red;
}
</style>
<script>
	$(function() {
		$( "input:submit, a, button" ).button();
	});
</script>
<script type="text/javascript">
	function validate_required(field, alerttxt) {
		with (field) {
			if (value == null || value == "") {
				alert(alerttxt);
				return false;
			} else {
				return true;
			}
		}
	}

	function validate_form(thisform) {
		with (thisform) {
			if (validate_required(userName, "User Name must be filled out!") == false) {
				userName.focus();
				return false;
			}
			else if (validate_required(password1, "Password must be filled out!") == false) {
			
				return false;
			}
			else if (validate_required(password2, "Password must be filled out again!") == false) {
			
				return false;
			}
			else if (pw1.value != pw2.value) {
				alert("Two passwords entered are different.");
				return false;
			}
			 else {
					return true;
				}
		}
	}
</script>
</head>
<body>
<div align="center">
<h1>Create an account</h1>
</div>
<div align="center">
<form action="/createAccountController" onsubmit="return validate_form(this)" method="post">
<table>
	<tr>
		<td>User Name:</td>
		<td><input type="text" name="userName"></td>
	</tr>
	<tr>
		<td>Password:</td>
		<td><input type="password" name="password1" id="pw1"></td>
	</tr>
	<tr>
		<td>Confirm your password:</td>
		<td><input type="password" name="password2" id="pw2"></td>
	</tr>
	
</table>
<%if(errorMessage != null) {%>
	<p style="color:#ff33ff"><%=errorMessage%></p>
<%} %>
<input type="submit" value="Register" /></form></div>
<div align="center">
<p><a href="welcome.jsp"> Back to the welcome page. </a></p>
</div>
</body>
</html>